package ningbo.Initialization_Cleanup;

/**
 * @Author 宁铂
 * @Date 2021/7/13 16:46
 * @Version 1.0
 */
public class Overloading {
    public static void main(String[] args) {
        for (int i = 0; i < 5; i++) {
            Tree tree = new Tree(i);
            tree.into();
            tree.into("重载方法");
        }
        new Tree();
    }
}


class Tree{
    int height;
    Tree(){
        System.out.println("栽种幼苗");
        height = 0;
    }

    //initialHeight 初识高度
    Tree(int initialHeight){
        height = initialHeight;
        System.out.println("此时树苗已经长到"+height+"米高了");
    }

    void into(){
        System.out.println("这个树苗已经"+height+"米高了");
    }

    void into(String s){
        System.out.println(s+"这个树苗已经"+height+"米高了");
    }
}

